<!doctype html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
    <script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
    <script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
    <script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
    <script crossorigin="anonymous" src="/test-harness.js"></script>
    <script crossorigin="anonymous" src="/test-page-object.js"></script>
    <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
    <script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
  </head>
  <body>
    <main id="webchat"></main>
    <script type="text/babel">
      run(async function () {
        const {
          React,
          ReactDOM: { render },
          WebChat: { FluentThemeProvider, ReactWebChat }
        } = window; // Imports in UMD fashion.

        const { directLine, store } = testHelpers.createDirectLineEmulator();

        const App = () => (
          <ReactWebChat directLine={directLine} store={store} styleOptions={{ suggestedActionLayout: 'flow' }} />
        );

        render(
          <FluentThemeProvider>
            <App />
          </FluentThemeProvider>,
          document.getElementById('webchat')
        );

        await pageConditions.uiConnected();

        await directLine.emulateIncomingActivity({
          type: 'message',
          textFormat: 'plain',
          text: 'Please select one of the actions below',
          suggestedActions: {
            actions: [
              { title: 'A', type: 'imBack' },
              { title: 'B', type: 'imBack' },
              { title: 'C', type: 'imBack' },
              { title: 'D', type: 'imBack' },
              { title: 'E', type: 'imBack' },
              { title: 'F', type: 'imBack' },
              { title: 'G', type: 'imBack' },
              { title: 'H', type: 'imBack' },
              { title: 'I', type: 'imBack' },
              { title: 'J', type: 'imBack' },
              { title: 'K', type: 'imBack' },
              { title: 'L', type: 'imBack' },
              { title: 'M', type: 'imBack' },
              { title: 'N', type: 'imBack' },
              { title: 'O', type: 'imBack' },
              { title: 'P', type: 'imBack' },
              { title: 'Q', type: 'imBack' },
              { title: 'R', type: 'imBack' },
              { title: 'S', type: 'imBack' },
              { title: 'T', type: 'imBack' },
              { title: 'U', type: 'imBack' },
              { title: 'V', type: 'imBack' },
              { title: 'W', type: 'imBack' },
              { title: 'X', type: 'imBack' },
              { title: 'Y', type: 'imBack' },
              { title: 'Z', type: 'imBack' }
            ],
            to: []
          }
        });

        // THEN: Should render the activity.
        await host.snapshot();
      });
    </script>
  </body>
</html>
